﻿using System.Windows.Media;
using Socium.Domain.Tests.Sociometric;
using Socium.Presentation;

namespace Socium.Testings.Sociometric {
	class ElectionViewModel : ViewModelBase {
		readonly ElectionCriteriaViewModel _election_criteria_view_model;
		readonly Election _election;

		public ElectionViewModel(Election election, ElectionCriteriaViewModel election_criteria_view_model) {
			_election_criteria_view_model = election_criteria_view_model;
			_election = election;

			_election_criteria_view_model.ColorChanged += ElectionCriteriaViewModelColorChanged;
		}

		void ElectionCriteriaViewModelColorChanged(object sender, System.EventArgs e) {
			OnPropertyChanged("Brush");
		}

		public ElectionCriteriaViewModel ElectionCriteria {
			get { return _election_criteria_view_model; }
		}

		public Brush Brush {
			get { return _election_criteria_view_model.Brush; }
		}

		public void Delete(Procedure procedure) {
			procedure.Elections.Remove(_election);
		}
	}
}
